package Homework;

import multiThreading.M;

import java.util.Scanner;

/**
 * @program: Java_Study
 * @author: Xiaofan
 * @createTime: 2021-07-06 20:41
 * @description: Functions of this class is 马鞍数
 **/
public class C3 {
    public static void main(String args[]){
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int n=scanner.nextInt();
            int nums[][]=new int[n][n];
            for(int i=0;i<n;i++){
                for(int j=0;j<n;j++){
                    nums[i][j]=scanner.nextInt();
                }
            }
            if(judge(nums)!=-1){
                System.out.println(judge(nums));
            }
            else{
                System.out.println("no");
            }
        }
    }
    private static int judge(int nums[][]){
        int ans=-1;
        int n=nums.length;
        boolean flag=true;
        for(int i=0;i<n;i++){
            int Minnum=nums[i][0];
            int J=0;
            int I=i;
            for(int j=0;j<n;j++){//找出一行中最小的数字
                if(nums[i][j]<Minnum){
                    J=j;
                    Minnum=nums[i][j];
                }
            }
            while (I<n){
                if(nums[I++][J]>Minnum){
                    flag=false;
                    break;
                }
            }
            if(flag){//说明找到了
                ans=Minnum;
                break;
            }
        }
        return ans;
    }
}